package com.by.controller;

/**
 * @author LSIR
 * @version 0.1
 * @className OrderController
 * @date 2024/9/79:25
 * @since jdk11
 */
import com.by.models.OrderingDto;
import com.by.models.OrderingOk;
import com.by.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/order")
@Slf4j
public class OrderController {

    private List<byte[]> bytes = new java.util.ArrayList<>();
    @GetMapping
    public String select(){
        bytes.add(new byte[1024*1024*100]);
        log.debug("请求进来了");
        return "123";
    }

    @GetMapping("/clean")
    public String clean(){
        bytes = new ArrayList<>();
        System.gc();
        log.debug("请求进来了");
        return "123";
    }

    @Autowired
    private OrderService orderService;

    @PostMapping
    public OrderingOk createOrder(@RequestBody OrderingDto order){
        return orderService.createOrder(order);
    }


}
